﻿/**
*导出类
*@module modules.output
*@class DCI.Export
*@constructor initialize
*/
define("output/export", [
    "leaflet",
    "core/dcins"
], function (L) {

    L.DCI.Export = L.Class.extend({

        type: {
            excel: "excel",
            word: "word",
            pdf: "pdf",
            txt:"txt"
        },
        /**
        *初始化
        *@method initialize
        */
        initialize: function (url) {

        },
        /**
        *导出excel
        *@method exportExcel
        *@param name {String} 名称
        *@param data {Array} 数据
        */
        exportExcel: function (options) {
            if (options.data && typeof options.data === "object")
                options.data.type = this.type.excel;
         return   L.dci.app.services.baseService.exportTo({
                    url:options.url,
                    data: options.data,
                    context: options.context,
                    success: options.success,
                    error: options.error,
                }); 
        },

        /*导出pdf*/
        exportPdf: function (options) {
        },

        /*导出word*/
        exportWord: function (options) {
            if (options.data && typeof options.data === "object")
                options.data.type = this.type.word;
         return   L.dci.app.services.baseService.exportTo({
                url: options.url,
                data: options.data,
                context: options.context,
                success: options.success,
                error: options.error,
            });
        },

    });
    L.dci.export = function () {
        return new L.DCI.Export();
    }
})
